function Authority(types='1') {
    var xhr = new XMLHttpRequest();
    var local_host = window.location.host;
    xhr.open('post', "/system-setup/authority_confirm", true);
    xhr.send("types="+String(types));
    xhr.onreadystatechange = function () {
        if (xhr.readyState === 4) {
            if (xhr.status === 200) {
                document.getElementById("loading").style.display = "none";
                var JsonDate = JSON.parse(xhr.responseText);

                if (JsonDate['flag'] === 'true'){
                    if (types === '1') {
                        window.location.href='/forum/middle_level_echart.html';
                    }else {
                        window.location.href='/forum/OfficialDocumentReport.html';
                    }
                }else{
                    alert("对不起，您的权限不足，请联系管理员！")
                }
            }
        }
    }
}

function Authority1() {
    var xhr = new XMLHttpRequest();
    var local_host = window.location.host;
    xhr.open('post', "/system-setup/document_confirm", true);
    xhr.send();
    xhr.onreadystatechange = function () {
        if (xhr.readyState === 4) {
            if (xhr.status === 200) {
                document.getElementById("loading").style.display = "none";
                var JsonDate = JSON.parse(xhr.responseText);

                if (JsonDate['flag'] === 'true'){
                    window.location.href='/forum/SuperiorOfficial.html'
                }else{
                    alert("对不起，您的权限不足，请联系管理员！")
                }
            }
        }
    }
}

function Authority2(types) {
    var xhr = new XMLHttpRequest();
    var local_host = window.location.host;
    xhr.open('post', "/system-setup/PrintingIssues", true);
    xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
    xhr.send("types="+types);
    xhr.onreadystatechange = function () {
        if (xhr.readyState === 4) {
            if (xhr.status === 200) {
                document.getElementById("loading").style.display = "none";
                var JsonDate = JSON.parse(xhr.responseText);

                if (JsonDate['flag'] === 'true'){
                    if (types === '0'){
                        window.location.href='/forum/print_report_echart.html'
                    }else if (types === '2') {
                        window.location.href='/personnel/contract_countersigning.html'
                    }else if (types === '3') {
                        window.location.href='/personnel/VehicleReport.html'
                    }else if (types === '4') {
                        window.location.href='/personnel/TravelReport.html'
                    }else {
                        window.location.href='/personnel/issue_statement.html'
                    }
                }else{
                    alert("对不起，您的权限不足，请联系管理员！")
                }

            }
        }
    }
}

function Authority3() {
    var xhr = new XMLHttpRequest();
    var local_host = window.location.host;
    xhr.open('post', "/system-setup/tra_bus_api", true);
    xhr.send();
    xhr.onreadystatechange = function () {
        if (xhr.readyState === 4) {
            if (xhr.status === 200) {
                document.getElementById("loading").style.display = "none";
                var JsonDate = JSON.parse(xhr.responseText);

                if (JsonDate['flag'] === 'true'){
                    window.location.href='/forum/TravelReport.html'
                }else{
                    alert("对不起，您的权限不足，请联系管理员！")
                }

            }
        }
    }
}

function Authority4() {
    var xhr = new XMLHttpRequest();
    var local_host = window.location.host;
    xhr.open('post', "/technological/LeaveReport", true);
    xhr.send();
    xhr.onreadystatechange = function () {
        if (xhr.readyState === 4) {
            if (xhr.status === 200) {
                document.getElementById("loading").style.display = "none";
                var JsonDate = JSON.parse(xhr.responseText);

                if (JsonDate['flag'] === 'true'){
                    window.location.href='/forum/LeaveReport.html'
                }else{
                    alert("对不起，您的权限不足，请联系管理员！")
                }

            }
        }
    }
}

function Authority5(ele_type) {
    var xhr = new XMLHttpRequest();
    var local_host = window.location.host;
    xhr.open('post', "/technological/SalaryAuthority", true);
    xhr.send();
    xhr.onreadystatechange = function () {
        if (xhr.readyState === 4) {
            if (xhr.status === 200) {
                document.getElementById("loading").style.display = "none";
                var JsonDate = JSON.parse(xhr.responseText);

                if (JsonDate['flag'] === 'true'){
                    if (ele_type === '1') {
                        window.location.href='/finance/salary_record_list_view'
                    }else {
                        window.location.href='/finance/import_salary_record_list_view'
                    }
                }else{
                    alert("对不起，您的权限不足，请联系管理员！")
                }

            }
        }
    }
}